| Total Complexity | 2 |
| Total Lines | 23 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import { IReliableSocketRequestPack } from "../interfaces/i-reliable-socket-request-pack"; |
||
| 4 | |||
| 5 | export class ReliableSocketRequestReceiver { |
||
| 6 | private emitQueuesConfirmations: IReliableSocketRequestQueues = { |
||
| 7 | default: [], |
||
| 8 | }; |
||
| 9 | |||
| 10 | public on( |
||
| 11 | socket: ISocketEmitter, |
||
| 12 | eventName: string, |
||
| 13 | callback: (response: any) => void, |
||
| 14 | ) { |
||
| 15 | socket.on(eventName, (response: IReliableSocketRequestPack) => { |
||
| 16 | callback(response.body); |
||
| 17 | }); |
||
| 18 | } |
||
| 19 | |||
| 20 | public once( |
||
| 21 | socket: ISocketEmitter, |
||
| 22 | eventName: string, |
||
| 23 | callback: (response: any) => void, |
||
| 24 | ) { |
||
| 25 | socket.once(eventName, (response: IReliableSocketRequestPack) => { |
||
| 26 | callback(response.body); |
||
| 27 | }); |
||
| 30 |